Skip to main content

Impression-level ad revenue

Impression-level ad revenue provides you with a granular calculation of how much revenue was generated by each ad impression.

The XMediator SDK provides this data on the ad's impression callback for you to use in your internal systems or any mobile measurement partner (MMP).

ImpressionData class

The ImpressionData class is passed as a parameter of the onImpression callbacks on each ad format.

FieldData typeDescription
revenueFloatEstimated revenue that the ad generated.
ecpmFloatEcpm value for the ad.
placementIdStringPlacement id of the waterfall used to load this ad.
adNetworkStringName of the network used to render this ad.
mediationStringName of the mediation service used to mediate this ad network.
subNetworkNameStringName of the sub network used to render this ad, if available.
creativeIdStringId of the creative rendered, if available.
adSpaceStringThe name of the ad space provided when showing the ad, if available.
waterfallResultLoadResultDescribes the result of the waterfall used to load this ad.
IdStringUnique identifier generated for the impression.

SDK-to-SDK integration samples

MMPs usually recommend an SDK-to-SDK integration over a S2S/API one, as they are able to provide less revenue matching discrepancies and more data in real time.

Adjust

XMediatorAds.Interstitial.addListener(object : InterstitialAds.Listener {

[...]

override fun onImpression(placementId: String, impressionData: ImpressionData) {
val adRevenue = AdjustAdRevenue(AdjustConfig.AD_REVENUE_SOURCE_PUBLISHER).apply {
setRevenue(impressionData.revenue.toDouble(), "USD")
setAdRevenueNetwork(impressionData.adNetwork)
setAdRevenueUnit(impressionData.placementId)
setAdRevenuePlacement(impressionData.adSpace)
}
Adjust.trackAdRevenue(adRevenue)
}
})

AppsFlyer

XMediatorAds.Interstitial.addListener(object : InterstitialAds.Listener {

[...]

override fun onImpression(placementId: String, impressionData: ImpressionData) {
val params = mapOf(
AFInAppEventParameterName.CURRENCY to "USD",
AFInAppEventParameterName.REVENUE to impressionData.revenue
)
AppsFlyerLib.getInstance().logEvent(activity, "af_ad_revenue", params)
}
})

Singular

XMediatorAds.Interstitial.addListener(object : InterstitialAds.Listener {

[...]

override fun onImpression(placementId: String, impressionData: ImpressionData) {
val singularData = SingularAdData(
impressionData.mediation,
"USD",
impressionData.revenue.toDouble()
)
singularData.withNetworkName(impressionData.adNetwork)
singularData.withAdPlacementName(impressionData.adSpace)
Singular.adRevenue(singularData)
}
})